project(demod)

add_subdirectory(demodlora)
add_subdirectory(demodam)
add_subdirectory(demodbfm)
add_subdirectory(demodnfm)
add_subdirectory(demodssb)
add_subdirectory(udpsink)
add_subdirectory(demodwfm)
add_subdirectory(chanalyzer)
add_subdirectory(demodatv)
add_subdirectory(localsink)
add_subdirectory(freqtracker)

if(LIBDSDCC_FOUND AND LIBMBE_FOUND)
    add_subdirectory(demoddsd)
endif(LIBDSDCC_FOUND AND LIBMBE_FOUND)

find_package(FFmpeg)
if (FFMPEG_FOUND)
	# You can only get FFmpeg version from the command line
	EXECUTE_PROCESS(COMMAND ffmpeg -version COMMAND grep ffmpeg COMMAND cut -d\  -f3 COMMAND tr -d '\n' OUTPUT_VARIABLE FFMPEG_VERSION)
	message(STATUS "FFmpeg version ${FFMPEG_VERSION} found")
	if(FFMPEG_VERSION VERSION_GREATER "3.1")
		message(STATUS "Include demoddatv")
		add_subdirectory(demoddatv)
	endif()
endif()

find_package(CM256cc)
if(CM256CC_FOUND)
    add_subdirectory(remotesink)
endif(CM256CC_FOUND)

find_package(Codec2)
if (CODEC2_FOUND)
    add_subdirectory(demodfreedv)
endif(CODEC2_FOUND)

if (BUILD_DEBIAN)
    add_subdirectory(demoddsd)
    add_subdirectory(remotesink)
endif (BUILD_DEBIAN)
